<?php
include_once "includes.php";
include_once "libs/Sajax.php";

function getParameters_($srv)
{
		$param = new parametro();
		return $param->find_by_servicio($srv->id);
}	

function getReturns_($srv)
{
		$param = new parametro();
		return $param->find_returns_by_servicio($srv->id);
}

function getService($srvId) 
{
	if ($srvId == 0)
		return null;
		
	$Servicio = new servicio();
	$srv = $Servicio->find_by_id($srvId);

	foreach( $srv as $s )
	{
		$s_ = $Servicio->find_last_version($s);
		
		$service = $s_[0];
		if ( $service )
		{	
			$service->cargar_parametros();
			return $service;
		}
	}

	return null;
}

sajax_init();
sajax_export("getService");
sajax_handle_client_request();
 
?>
